package org.platform;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.spring.annotation.MapperScan;


@SpringBootApplication
@MapperScan(basePackages = {"org.platform.dao.mapper", "com.mc.mic.core"}, markerInterface = Mapper.class)
@ComponentScan(basePackages = {"org.platform", "com.mc.mic.core"})
@EnableEurekaClient

/**
 * 继承 SpringBootServletInitializer 是为了让项目生成war包(默认是jar)
 */
public class BreakdownCheckApplication {
//public class BreakdownCheckApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(BreakdownCheckApplication.class, args);
    }


    //自定义服务实例健康状态,会使用到服务均衡中
    @Bean
    public AbstractHealthIndicator healthIndicator() {
        return new AbstractHealthIndicator() {
            @Override
            protected void doHealthCheck(Health.Builder builder) {
                builder.up().withDetail("msg", "个人定义的");
            }
        };
    }


    /**
     * 重写configure 方法。
     * 通过形参 application 的 source 方法启动启动类 Application
     */
    //@Override
    // protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    //     return application.sources(BreakdownCheckApplication.class);
    // }


}
